package ar.edu.unlam.tpfinal.struts.actions.address;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessages;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import ar.edu.unlam.tpfinal.struts.forms.AddressForm;

public class BaseAddressAction extends Action {
	
	protected Logger logger = LoggerFactory.getLogger(BaseAddressAction.class);
	
	public boolean validate(ActionMapping mapping, HttpServletRequest request, AddressForm form) {
		boolean isOk = true;

		ActionMessages errors = form.validate(mapping, request);
		
		if(!errors.isEmpty()) {
			saveErrors(request, errors);
			isOk = false;
		}
		
		return isOk;
	}

}